Occurs before a selected record is deleted in a DataGrid control.
Syntax
Private Sub object_BeforeDelete ([index As Integer,] cancel As Integer)
The BeforeDelete event syntax has these parts:
Part | Description |
object | An object expression that evaluates to an object in the Applies To list. |
index | An integer that identifies a control if it is in a control array. |
cancel | A Boolean expression that determines whether a record is deleted, as described in Settings. |
Settings
The settings for cancel are:
Setting | Description |
True | Leaves focus on control and doesn't delete the record. |
False | (Default) Continues with delete operation and enables change of focus. |
Remarks
When the user selects a record selector in the control and presses DEL or CTL+X, the BeforeDelete event is triggered before the selected row is deleted.
Once the row is deleted, the AfterDelete event is triggered. The row selected for deletion is available in the collection provided by the SelBookmarks property.
If your event procedure sets the canceI argument to True, the row isn't deleted.
If more than one row is selected, the error message Multiple rows cannot be deleted
is displayed.